<template>
    <div class="details_swiper">
        <van-swipe @change="onChange">
            <van-swipe-item v-for="(v,i) in imgarr" :key=i><img :src="v.img_path"></van-swipe-item>
            <template #indicator>
                <div class="custom-indicator">{{ current + 1 }}/{{imgarr.length}}</div>
            </template>
        </van-swipe>
        <van-icon name="arrow-left" @click="back()"/>
    </div>
</template>

<script>
export default {
    props:["imgarr"],
    data() {
        return {
            current: 0,
        };
    },
    methods: {
        onChange(index) {
            this.current = index;
        },
        back(){
            this.$router.go(-1)
        }
    },
    mounted(){

    }
}
</script>

<style scoped>
    .details_swiper{
        width:100%;
        height: 2.82rem;
        background-color: aquamarine;
        position: relative;
        margin-bottom: 0.1rem;
    }
    img{
        width: 100%;
        height: 2.82rem;
    }
    .van-swipe{
        width: 100%;
        height: 100%;
    }
    .custom-indicator {
        height: 0.2rem;
        width: 0.4rem;
        border-radius: 0.07rem;
        position: absolute;
        right: 0.15rem;
        bottom: 0.15rem;
        font-size: 0.15rem;
        color: #fff;
        text-align: center;
        line-height: 0.2rem;
        background: rgba(0, 0, 0, 0.2);
    }
    .van-icon{
        position: absolute;
        top: 0.3rem;
        left: 0.17rem;
        height: 0.3rem;
        width: 0.3rem;
        border-radius: 50%;
        line-height: 0.3rem;
        text-align: center;
        font-size: 0.16rem;
        color: #fff;
        font-weight: bold;
        background: rgba(0, 0, 0, 0.2);
    }
</style>